﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Transactions;

using MINERP.DAL;
using MINERP.DAL.InfoConfig;

namespace MINERP.BLL.InfoConfig
{
    public class FolderBLL
    {
        /// <summary>
        /// 获取文件夹对象list
        /// </summary>
        /// <returns></returns>
        public List<FileDirPath> GetFolderList()
        {
            return FolderDAL.GetFolderList();
        }
        /// <summary>
        /// 获取单个文件夹对象
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public FileDirPath GetFolderObj(int id)
        {
            return FolderDAL.GetFolderObj(id);
        }
        public FileDirPath GetFolderObj(string name)
        {
            using (newSampleYPDBEntities entities = new newSampleYPDBEntities())
            {
                return entities.FileDirPath.FirstOrDefault(f => f.FileDir.Contains(name));
            }
        }
        /// <summary>
        /// 添加文件夹
        /// </summary>
        /// <param name="obj"></param>
        public void Add(FileDirPath obj)
        {
            FolderDAL.AddFolder(obj);
        }
        /// <summary>
        /// 更新文件夹
        /// </summary>
        /// <param name="obj"></param>
        public void Update(FileDirPath obj)
        {
            FolderDAL.UpdateFolder(obj);
        }
        /// <summary>
        /// 删除文件夹
        /// </summary>
        /// <param name="obj"></param>
        public void Delete(FileDirPath obj)
        {
            FolderDAL.DeleteFolder(obj);
        }
    }
}
